-module(talk).
-include_lib("nitrogen/include/wf.inc").
-compile(export_all).
 
hi(Program) ->
    %process_flag(trap_exit, true),
    open_port({spawn, Program}, [stream, {line, 1048576}]).

say(Port, Say) ->
    port_command(Port, Say ++ "\n"),
    receive 
	{Port, {data, {_, Result}}} ->
	    Result;
	_ ->
	    ""
    end.

bye(Port)->
    port_close(Port).
